package com.test.daily.leetcode.y2022.m05.day0519.v06;

/**
 * @descriptions: Solution
 * @author: Tom
 * @date: 2022/5/19 下午 11:05
 * @version: 1.0
 */
public class Solution {
    public static class Node {
        int value;
        Node left;
        Node right;

        public Node(int value) {
            this.value = value;
        }
    }

    public static void pre(Node root) {
        if (root == null) {
            return;
        }
        System.out.println(root.value);
        if (root.left != null) {
            pre(root.left);
        }
        if (root.right != null) {
            pre(root.right);
        }
    }

    public static void in(Node root) {
        if (root == null) {
            return;
        }
        if (root.left != null) {
            in(root.left);
        }
        System.out.println(root.value);
        if (root.right != null) {
            in(root.right);
        }
    }

    public static void post(Node root) {
        if (root == null) {
            return;
        }
        if (root.left != null) {
            post(root.left);
        }
        if (root.right != null) {
            post(root.right);
        }
    }
}
